//---------------------------------------------------------------------------

#ifndef XTrayIconH
#define XTrayIconH


#ifdef _WIN32_IE
#undef _WIN32_IE
#endif
#define _WIN32_IE 0x0500

#include <classes.hpp>
#include <Menus.hpp>
#include <forms.hpp>
//---------------------------------------------------------------------------

//Tipos aceitos pela funcao Ballon
    //NIIF_INFO
    //NIIF_ERROR
    //NIIF_WARNING
    //NIIF_USER
    //NIIF_NONE


#ifdef NIN_BALLOONSHOW
#undef NIN_BALLOONSHOW
#endif
#define NIN_BALLOONSHOW         (WM_USER+2)

#ifdef NIN_BALLOONHIDE
#undef NIN_BALLOONHIDE
#endif
#define NIN_BALLOONHIDE         (WM_USER+3)

#ifdef NIN_BALLOONTIMEOUT
#undef NIN_BALLOONTIMEOUT
#endif
#define NIN_BALLOONTIMEOUT      (WM_USER+4)

#ifdef NIN_BALLOONUSERCLICK
#undef NIN_BALLOONUSERCLICK
#endif
#define NIN_BALLOONUSERCLICK    (WM_USER+5)

#define TRAY_CALLBACK           (WM_USER+0x7258)

class TXTrayIcon
{
private:
    bool          FVisible;
    TNotifyEvent  FOnClick;
    TNotifyEvent  FOnClose;
    TNotifyEvent  FOnDldClick;

protected:
    NOTIFYICONDATA icon;

    void __fastcall WndProc(TMessage &Msg);

public:
    TPopupMenu  *Popup;

    __fastcall TXTrayIcon();
    __fastcall ~TXTrayIcon();

    bool __fastcall Add(HICON hIcon, char *tip);
    bool __fastcall Icon(HICON hIcon, char *tip);
    bool __fastcall Remove(void);
    bool __fastcall Ballon(unsigned tipo, char *titulo,
                                               char *texto, unsigned timeout);
    void __fastcall Minimize(void);
    void __fastcall Restore(void);

    __property bool Visible= {read= FVisible};
    __property TNotifyEvent OnClick= {read= FOnClick, write= FOnClick};
    __property TNotifyEvent OnClose= {read= FOnClose, write= FOnClose};
    __property TNotifyEvent OnDldClick= {read= FOnDldClick, write= FOnDldClick};
};

#endif
